def category
end

def categories_categories(path = @datadir)
  src = ""
  Dir.foreach(path){|d|
    fulld = "#{path}/#{d}"
    if d != "." and d != ".."then
      fs = []
      @file_extension.each do |fext|
        fs += Dir.glob("#{fulld}/**/*.#{fext}")
      end
      if !fs.nil? and fs.size > 0 then
        pi = fulld.sub("#{@datadir}/","")
        # src << "<li><a href=\"#{@url}/#{pi}\">#{get_alias_name(d)}</a>[#{fs.size.to_s}]\n"
        src << "<li><a href=\"#{@url}/#{pi}\">#{get_alias_name(d)}</a>\n"
        src << categories_categories(fulld)
        src << "</li>\n"
      end
    end
  }
  if src != "" then
     src = "<ul>\n" + src + "</ul>\n"
  end
  return src
end

def get_alias_name(path)
  if path.index('/')
    _ = []
	 path.split('/').each {|d| _ << get_alias_name(d) }
	 _.join('/')
  else
    (@env["category::#{path}"]) ? @env["category::#{path}"] : path
  end
end
